/**
 * 
 */
package org.mspring.mlog.service.impl;

import org.mspring.mlog.entity.Twitter;
import org.mspring.mlog.service.TwitterReplyService;
import org.mspring.mlog.service.TwitterService;
import org.mspring.platform.dao.hibernate.GenericDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Gao Youbo
 * @since 2013-5-24
 * @description
 * @TODO
 */
@Service
@Transactional
public class TwitterServiceImpl extends GenericDao<Twitter, java.lang.Long> implements TwitterService {
    @Autowired
    private TwitterReplyService twitterReplyService;

    @Override
    public void remove(Twitter object) {
        // TODO Auto-generated method stub
        if (object == null || object.getId() == null) {
            return;
        }
        remove(object.getId());
    }

    @Override
    public void remove(Long... ids) {
        // TODO Auto-generated method stub
        if (ids == null || ids.length == 0) {
            return;
        }
        for (Long id : ids) {
            twitterReplyService.deleteReply(id);
            super.remove(id);
        }
    }

}
